<script type="text/javascript">
$(document).ready(function () {
$("#saveContent").click(function () {
		$("#loader").fadeIn()
	});
	var url = $.url(document.location.href);
	if (url.segment(-1) != "update" && url.segment(-2) != "update") {
		if (url.fsegment(1) == "back" || url.fsegment(1) == "save") {
			if ($("#start").val() == "") {
				$("#start").val(0)
			}
			searchContent($("#start").val(), 10);
		} else {
			if (url.segment(-1) != "update_profile") {
				if (module != "admincp") {
					searchContent(0, 10);
				}
			}
		}
	}
	$(".gr_perm_error").width($(".right_content").width() - 2)
});
function searchContent(start, per_page) {
	if (per_page == undefined) {
		if ($("#per_page").val()) {
			per_page = $("#per_page").val();
		} else {
			per_page = 10;
		}
	}
	var func_sort = $("#func_sort").val();
	var type_sort = $("#type_sort").val();
	$("#start").val(start);
	$.post(root + "admincp/" + module + "/ajaxLoadContent", {
		func_order_by : func_sort,
		order_by : type_sort,
		start : start,
		per_page : per_page,
	}, function (data) {
		$("#ajax_loadContent").html(data);
		$(".custom_chk").jqTransCheckBox();
		$(".fancyboxClick").fancybox();
		$(".sort").removeClass("icon_sort_desc");
		$(".sort").removeClass("icon_sort_asc");
		$(".sort").addClass("icon_no_sort");
		if (type_sort == "DESC") {
			$("#" + func_sort).addClass("icon_sort_desc");
		} else {
			$("#" + func_sort).addClass("icon_sort_asc");
		}
	})
}
</script>
<input type="hidden" value="<?php ($this->session->userdata('start'))? print $this->session->userdata('start') : print 0 ?>" id="start" />
<input type="hidden" value="<?=$default_func?>" id="func_sort" />
<input type="hidden" value="<?=$default_sort?>" id="type_sort" />
<div class="gr_perm_error" style="display:none;">
	<p><strong>FAILURE: </strong>Permission Denied.</p>
</div>
<div id="indexView" class="table">
	<div class="head_table_1">
		<div class="head_title_table"><?=$module_name?></div>
		<div class="head_search">
			<div class="head_search_title fontface" style="margin-top: 9px">Search | </div>
			<div class="head_search_title">From:</div>
			<div class="head_search_input"><input onkeypress="return enterSearch(event)" id="caledar_from" type="text" /></div>
			<div class="head_search_title">To:</div>
			<div class="head_search_input"><input onkeypress="return enterSearch(event)" id="caledar_to" type="text" /></div>
			<div class="head_search_title">Content:</div>
			<div class="head_search_input"><input onkeypress="return enterSearch(event)" id="search_content" onclick="if(this.value=='type here...'){this.value=''}" onblur="if(this.value==''){this.value='type here...'}" class="input_last" type="text" value="type here..." /><div onclick="searchContent(0)" class="bt_search"><img alt="Button search" src="<?=PATH_URL.'static/images/admin/icons/searchSmall.png'?>" /></div></div>
		</div>
	</div>
	<div class="clearAll"></div>
	
	<div id="ajax_loadContent"><img class="loading" alt="Ajax Loader" src="<?=PATH_URL.'static/images/admin/ajax-loader.gif'?>" /></div>
</div>